﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Reflection;

namespace Vehicle.BLL
{
    public sealed class BLLFactory
    {
        //BLL路径
        private static readonly string path = Vehicle.Common.WebConfig.WebBLL;

        /// <summary>
        /// 获取BLL层Base_BLL
        /// </summary>
        /// <returns>IAdmin</returns>
        public static IBase_BLL CreateBase_BLL()
        {
            string className = path + ".Base_BLL";
            return (IBase_BLL)Assembly.Load(path).CreateInstance(className);
        }

        /// <summary>
        /// 获取BLL层Admin
        /// </summary>
        /// <returns>IAdmin</returns>
        public static IAdmin CreateAdmin()
        {
            string className = path + ".Admin";
            return (IAdmin)Assembly.Load(path).CreateInstance(className);
        }

        /// <summary>
        /// 获取BLL层Permissions
        /// </summary>
        /// <returns></returns>
        public static IPermissions CreatePermissions()
        {
            string className = path + ".Permissions";
            return (IPermissions)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Role
        /// </summary>
        /// <returns></returns>
        public static IRole CreateRole()
        {
            string className = path + ".Role";
            return (IRole)Assembly.Load(path).CreateInstance(className);
        }

        /// <summary>
        /// 获取BLL层RolePermission
        /// </summary>
        /// <returns></returns>
        public static IRolePermission CreateRolePermission()
        {
            string className = path + ".RolePermission";
            return (IRolePermission)Assembly.Load(path).CreateInstance(className);
        }

        /// <summary>
        /// 获取BLL层Motorcade
        /// </summary>
        /// <returns></returns>
        public static IMotorcade CreateMotorcade()
        {
            string className = path + ".Motorcade";
            return (IMotorcade)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Vechicle
        /// </summary>
        /// <returns></returns>
        public static IVehicles CreatedVehicles()
        {
            string className = path + ".Vehicles";
            return (IVehicles)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Pilot
        /// </summary>
        /// <returns></returns>
        public static IPilot CreatedPilot()
        {
            string className = path + ".Pilot";
            return (IPilot)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Cargo
        /// </summary>
        /// <returns></returns>
        public static ICargo CreatedCargo()
        {
            string className = path + ".Cargo";
            return (ICargo)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Expense
        /// </summary>
        /// <returns></returns>
        public static IExpense CreatedExpense()
        {
            string className = path + ".Expense";
            return (IExpense)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Task
        /// </summary>
        /// <returns></returns>
        public static ITask CreatedTask()
        {
            string className = path + ".Task";
            return (ITask)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Log
        /// </summary>
        /// <returns></returns>
        public static ILog CreatedLog()
        {
            string className = path + ".Log";
            return (ILog)Assembly.Load(path).CreateInstance(className);
        }
        /// <summary>
        /// 获取BLL层Post
        /// </summary>
        /// <returns></returns>
        public static IPost CreatedPost()
        {
            string className = path + ".Post";
            return (IPost)Assembly.Load(path).CreateInstance(className);
        }
    }
}
